package com.tttn.docbao.activity;

import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.AsyncTask;
import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;

import com.tttn.docbao.R;

public class NewsActivity extends Activity {
	private WebView webview;
	private String link;
	private Bitmap image;
	private ProgressDialog dialog;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_read);
		Intent intent = getIntent();
		link = intent.getStringExtra("link") + "?view=app";
		// Toast.makeText(getApplicationContext(), link, 1).show();
		setTitle(R.string.app_name);
		webview = (WebView) findViewById(R.id.content);
		webview.getSettings().setSupportZoom(true);
		webview.setInitialScale(1);
		webview.getSettings().setLoadWithOverviewMode(true);
		webview.getSettings().setUseWideViewPort(true);
		webview.setScrollBarStyle(webview.SCROLLBARS_OUTSIDE_OVERLAY);
		webview.setScrollbarFadingEnabled(false);
		webview.getSettings().setBuiltInZoomControls(true);
		webview.getSettings().setJavaScriptEnabled(true);
		webview.setWebViewClient(new webviewclient());
		dialog = ProgressDialog.show(this, "Loading ...", "");
		webview.loadUrl(link);
	}

	class webviewclient extends WebViewClient {

		@Override
		public void onPageFinished(WebView view, String url) {
			// TODO Auto-generated method stub
			if (dialog != null)
				dialog.dismiss();
			super.onPageFinished(view, url);
		}

	}

}